Add logging for icon fallback
authorMatthias Clasen <mclasen@redhat.com>
Thu, 25 Mar 2021 21:26:15 +0000 (17:26 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 25 Mar 2021 21:26:15 +0000 (17:26 -0400)
Add GTK_DEBUG=iconfallback which prints out what icon names
we fall back to image-missing for.

gtk/gtkdebug.h
gtk/gtkicontheme.c
gtk/gtkmain.c

index ac85014d74005a0a94aa4c2eb655ed759c53896a..4a10c96cffd64316301684d12ba764fd7b5c74e0 100644 (file)
@@ -53,6 +53,7 @@ typedef enum {
   GTK_DEBUG_CONSTRAINTS     = 1 << 15,
   GTK_DEBUG_BUILDER_OBJECTS = 1 << 16,
   GTK_DEBUG_A11Y            = 1 << 17,
+  GTK_DEBUG_ICONFALLBACK    = 1 << 18,
 } GtkDebugFlags;
 
 #ifdef G_ENABLE_DEBUG
index ef1e70a0b2758cb1ba01cd21d052a223ca85c5f4..7486457e176c64dc65ccdb0450cb3385ec91aa71 100644 (file)
@@ -2269,6 +2269,11 @@ real_choose_icon (GtkIconTheme      *self,
   /* Fall back to missing icon */
   if (icon == NULL)
     {
+      GTK_NOTE(ICONFALLBACK, {
+        char *s = g_strjoinv (", ", (char **)icon_names);
+        g_message ("No icon found for: %s", s);
+        g_free (s);
+      });
       icon = icon_paintable_new ("image-missing", size, scale);
       icon->filename = g_strdup (IMAGE_MISSING_RESOURCE_PATH);
       icon->is_resource = TRUE;
index 02c37b045e9c2d9a09dbc9a0f673652c509eb6ae..27dea0f0076db837aacd55fdc3863d3159155dbe 100644 (file)
@@ -197,6 +197,7 @@ static const GdkDebugKey gtk_debug_keys[] = {
   { "touchscreen", GTK_DEBUG_TOUCHSCREEN, "Pretend the pointer is a touchscreen" },
   { "snapshot", GTK_DEBUG_SNAPSHOT, "Generate debug render nodes" },
   { "accessibility", GTK_DEBUG_A11Y, "Information about accessibility state changes" },
+  { "iconfallback", GTK_DEBUG_ICONFALLBACK, "Information about icon fallback" },
 };
 
 /* This checks to see if the process is running suid or sgid